package edu.cmu.cs211.proximitycounter.counter;

import java.util.Comparator;

public class Point implements Comparable<Point> {
    
	private int x;
	private int y;
	
	public static final Compy compy = new Compy();
    
	public int compareTo(Point q) {
		if (this.x != q.x) 
			return this.x-q.x;
		if (this.y != q.y) 
			return this.y-q.y;
		return 0;
    }
	
    public Point (int x, int y) {
    	this.x = x; this.y = y;
    }
    
    public String toString() {
    	return "("+x+","+y+")";
    }
    
    public int getX()
    {
    	return x;
    }
    
    public int getY()
    {
    	return y;
    }
    
    public void setX(int x)
    {
    	this.x = x; 
    }
    
    public void setY(int y)
    {
    	this.y = y; 
    }
    
    static class Compy implements Comparator<Point> {
        public int compare(Point a, Point b) {
        	Point p = a, q = b;
        	
        	if (p.y != q.y) 
        		return p.y-q.y;
        	return 0;
        }
    }
}